package org.example.observe.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.example.observe.service.OrderEvent;
import org.example.observe.service.OrderObserve;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

/**
 * 统计业务:统计成交量
 */
@Slf4j
@Service
public class StatisticsServiceImpl implements
        OrderObserve ,
        ApplicationListener<OrderEvent> {// Spring方式
    @Override
    public void paySuccess(String orderNo) {
        log.info("统计业务:统计成交量,{}",orderNo);
    }

    @Override
    public void onApplicationEvent(OrderEvent event) {
        log.info("统计业务:统计成交量,{}",event.getSource());
    }
}
